//
//  QYCenterButton.m
//  QingYue
//
//  Created by Zheng on 2019/3/19.
//  Copyright © 2019 com.lanou.product_A. All rights reserved.
//

#import "QYCenterButton.h"
#import "QYScanViewController.h"
#import "BaseNavigationController.h"

@implementation QYCenterButton


#pragma mark - Life Cycle
+ (void)load {
    //请在 `-[AppDelegate application:didFinishLaunchingWithOptions:]` 中进行注册，否则iOS10系统下存在Crash风险。
    //[super registerPlusButton];
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.adjustsImageWhenHighlighted = NO;
    }
    return self;
}

#pragma mark - CYLPlusButtonSubclassing Methods
+ (id)plusButton {
    QYCenterButton *button = [[QYCenterButton alloc] init];
    UIImage *normalButtonImage = [UIImage imageNamed:@"中间绿"];
    [button setImage:normalButtonImage forState:UIControlStateNormal];
    button.frame = CGRectMake(0.0, 0.0, 59, 59);
    [button addTarget:button action:@selector(clickPublish) forControlEvents:UIControlEventTouchUpInside];
    return button;
    
}

#pragma mark - Event Response
- (void)clickPublish {
    
}


#pragma mark - CYLPlusButtonSubclassing
+ (CGFloat)multiplierOfTabBarHeight:(CGFloat)tabBarHeight {
    return  0.15;
}

+ (CGFloat)constantOfPlusButtonCenterYOffsetForTabBarHeight:(CGFloat)tabBarHeight {
    return (CYL_IS_IPHONE_X ? - 6 : 4);
}

+ (UIViewController *)plusChildViewController {
    QYScanViewController *spVC = [[QYScanViewController alloc] init];
    BaseNavigationController *navVC = [[BaseNavigationController alloc] initWithRootViewController:spVC];
    return navVC;
}

+ (NSUInteger)indexOfPlusButtonInTabBar {
    return 2;
}
@end
